// 编译时定义的多维数组
template <typename T, size_t... Dims>
class MultiArray;

// 一维数组特化
template <typename T, size_t N>
class MultiArray<T, N>
{
    T data[N];

public:
    T &operator[](size_t i) { return data[i]; }
    const T &operator[](size_t i) const { return data[i]; }

    // 获取元素总数
    static constexpr size_t size() { return N; }
};

// 多维数组递归特化
template <typename T, size_t First, size_t... Rest>
class MultiArray<T, First, Rest...>
{
    MultiArray<T, Rest...> data[First];

public:
    MultiArray<T, Rest...> &operator[](size_t i) { return data[i]; }
    const MultiArray<T, Rest...> &operator[](size_t i) const { return data[i]; }

    // 获取元素总数
    static constexpr size_t size() { return First * MultiArray<T, Rest...>::size(); }
};

// 使用示例 - 3D点云处理
void process_point_cloud()
{
    // 创建100x100x100的3D体素网格
    MultiArray<float, 100, 100, 100> voxel_grid;

    // 访问特定体素
    voxel_grid[50][25][75] = 1.0f;

    // 编译时获取元素总数
    constexpr size_t total_voxels = MultiArray<float, 100, 100, 100>::size();
    std::cout << "Total voxels: " << total_voxels << std::endl;
}